package 剑指offer;

import java.util.ArrayList;
import java.util.List;

/**
 * @description:
 * @author: ywk
 * @date: 2021-03-04
 */
public class 随机数100 {
    public static void printRandom(int n) {
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(i);
        }
        while (n > 0) {
            int random = (int) (Math.random() * n);
            System.out.print(list.get(random) + "\t");
            list.remove(random);
            n--;
        }
    }

    public static void main(String[] args) {
        printRandom(100);
    }
}
